<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>test | Jacklisp</title>
  <meta name="keywords" content=" vim ">
  <meta name="description" content="test | Jacklisp">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="emacs 学习elisp学习相关package使用学习mode linemode line 表现为emacs 下方的一个信息栏，您可以将关于文档的一些相关信息在mode line栏里显示，比如当前buffer的major mode、minior mode、当前所处的光标行数、文件名，当前路径名等等。mode line的编辑相对复杂。 相关用法 mode line的表现形式由变量 mode-lin">
<meta property="og:type" content="article">
<meta property="og:title" content="emacs">
<meta property="og:url" content="http://yoursite.com/2020/05/30/emacs/index.html">
<meta property="og:site_name" content="Jacklisp">
<meta property="og:description" content="emacs 学习elisp学习相关package使用学习mode linemode line 表现为emacs 下方的一个信息栏，您可以将关于文档的一些相关信息在mode line栏里显示，比如当前buffer的major mode、minior mode、当前所处的光标行数、文件名，当前路径名等等。mode line的编辑相对复杂。 相关用法 mode line的表现形式由变量 mode-lin">
<meta property="article:published_time" content="2020-05-30T08:20:39.000Z">
<meta property="article:modified_time" content="2020-06-11T22:30:03.921Z">
<meta property="article:author" content="Jacklisp">
<meta property="article:tag" content="emacs">
<meta name="twitter:card" content="summary">


<link rel="icon" href="/img/avatar.jpg">

<link href="/blog/css/style.css?v=1.0.1" rel="stylesheet">

<link href="/blog/css/hl_theme/atom-light.css?v=1.0.1" rel="stylesheet">

<link href="//cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="stylesheet">
<link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="/blog/js/jquery.autocomplete.min.js?v=1.0.1" ></script>

<script src="//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

<script src="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>



<script src="//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js" ></script>

<script src="/blog/js/iconfont.js?v=1.0.1" ></script>

<meta name="generator" content="Hexo 4.2.0"></head>
<div style="display: none">
  <input class="theme_disqus_on" value="false">
  <input class="theme_preload_comment" value="false">
  <input class="theme_blog_path" value="/blog">
</div>

<body>
<aside class="nav">
    <div class="nav-left">
        <a href="/blog/" class="avatar_target">
    <img class="avatar" src="/blog/img/avatar.jpg" />
</a>
<div class="author">
    <span>Jacklisp</span>
</div>

<div class="icon">
    
        
        <a title="rss" href="/atom.xml" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-rss"></use>
                </svg>
            
        </a>
        
    
        
        <a title="github" href="https://github.com/yelog" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-github"></use>
                </svg>
            
        </a>
        
    
        
        <a title="facebook" href="https://www.facebook.com/faker.tops" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-facebook"></use>
                </svg>
            
        </a>
        
    
        
    
        
    
        
        <a title="instagram" href="https://www.facebook.com/faker.tops" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-instagram"></use>
                </svg>
            
        </a>
        
    
        
        <a title="reddit" href="https://www.reddit.com/user/yelog/" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-reddit"></use>
                </svg>
            
        </a>
        
    
        
        <a title="weibo" href="http://weibo.com/u/2307534817" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-weibo"></use>
                </svg>
            
        </a>
        
    
        
        <a title="jianshu" href="https://www.jianshu.com/u/ff56736de7cf" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-jianshu"></use>
                </svg>
            
        </a>
        
    
        
        <a title="zhihu" href="https://www.zhihu.com/people/jaytp/activities" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-zhihu"></use>
                </svg>
            
        </a>
        
    
        
    
        
        <a title="oschina" href="https://my.oschina.net/yelog" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-oschina"></use>
                </svg>
            
        </a>
        
    
        
    
        
        <a title="email" href="mailto:jaytp@qq.com" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-email"></use>
                </svg>
            
        </a>
        
    
        
        <a title="qq" href="http://wpa.qq.com/msgrd?v=3&uin=872336115&site=qq&menu=yes" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-qq"></use>
                </svg>
            
        </a>
        
    
        
        <a title="kugou" href="https://www.kugou.com/" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-kugou"></use>
                </svg>
            
        </a>
        
    
        
        <a title="neteasemusic" href="https://music.163.com/#/user/home?id=88151013" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-neteasemusic"></use>
                </svg>
            
        </a>
        
    
</div>




<ul>
    <li><div class="all active">全部文章<small>(16)</small></div></li>
    
</ul>
<div class="left-bottom">
    <div class="menus">
    
    
    
    
    </div>
    <div><a class="about  hasFriend  site_url"  href="/about">关于</a><a style="width: 50%"  class="friends">友链</a></div>
</div>
<input type="hidden" id="yelog_site_posts_number" value="16">

<div style="display: none">
    <span id="busuanzi_value_site_uv"></span>
    <span id="busuanzi_value_site_pv"></span>
</div>

    </div>
    <div class="nav-right">
        <div class="friends-area">
    <div class="friends-title">
        友情链接
        <i class="back-title-list"></i>
    </div>
    <div class="friends-content">
        <ul>
            
            <li><a target="_blank" href="http://yelog.org/">叶落阁</a></li>
            
        </ul>
    </div>
</div>
        <div class="title-list">
    <form onkeydown="if(event.keyCode === 13){return false;}">
        <input id="local-search-input" class="search" type="text" placeholder="Search..." />
        <i class="cross"></i>
        <span>
            <label for="tagswitch">Tags:</label>
            <input id="tagswitch" type="checkbox" style="display: none" />
            <i id="tagsWitchIcon"></i>
        </span>
    </form>
    <div class="tags-list">
    
    <li class="article-tag-list-item">
        <a class="color1">emacs</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">科研</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">git</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">android</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">linux</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">learn</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">vim</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">test3</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">machine learning</a>
    </li>
    
    <div class="clearfix"></div>
</div>

    
    <nav id="title-list-nav">
        
        <a  class=""
           href="/blog/2020/03/29/hello-org/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="hello-org">hello-org</span>
            <span class="post-date" title="2020-03-29 08:17:55">2020/03/29</span>
        </a>
        
        <a  class=""
           href="/blog/2020/03/29/hello-world/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="Hello World">Hello World</span>
            <span class="post-date" title="2020-03-29 07:58:40">2020/03/29</span>
        </a>
        
        <a  class=""
           href="/blog/2020/03/29/test2/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="test2">test2</span>
            <span class="post-date" title="2020-03-29 16:13:35">2020/03/29</span>
        </a>
        
        <a  class=""
           href="/blog/2020/03/29/hexo-%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E8%AE%B0%E5%BD%95/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="hexo 常用命令记录">hexo 常用命令记录</span>
            <span class="post-date" title="2020-03-29 16:19:41">2020/03/29</span>
        </a>
        
        <a  class=""
           href="/blog/2020/04/07/emacs-compile/"
           data-tag="emacs"
           data-author="" >
            <span class="post-title" title="emacs-compile">emacs-compile</span>
            <span class="post-date" title="2020-04-07 08:39:56">2020/04/07</span>
        </a>
        
        <a  class=""
           href="/blog/2020/04/09/sci-draw/"
           data-tag="科研"
           data-author="" >
            <span class="post-title" title="sci_draw">sci_draw</span>
            <span class="post-date" title="2020-04-09 07:48:20">2020/04/09</span>
        </a>
        
        <a  class=""
           href="/blog/2020/04/17/git/"
           data-tag="git"
           data-author="" >
            <span class="post-title" title="git">git</span>
            <span class="post-date" title="2020-04-17 14:18:03">2020/04/17</span>
        </a>
        
        <a  class=""
           href="/blog/2020/04/18/android-course/"
           data-tag="android"
           data-author="" >
            <span class="post-title" title="android-course">android-course</span>
            <span class="post-date" title="2020-04-18 07:53:18">2020/04/18</span>
        </a>
        
        <a  class=""
           href="/blog/2020/04/18/emacs-evil/"
           data-tag="emacs"
           data-author="" >
            <span class="post-title" title="emacs-evil">emacs-evil</span>
            <span class="post-date" title="2020-04-18 16:20:35">2020/04/18</span>
        </a>
        
        <a  class=""
           href="/blog/2020/04/29/linux/"
           data-tag="linux"
           data-author="" >
            <span class="post-title" title="linux">linux</span>
            <span class="post-date" title="2020-04-29 19:12:24">2020/04/29</span>
        </a>
        
        <a  class=""
           href="/blog/2020/04/30/%E8%B4%B9%E6%9B%BC%E6%95%99%E5%AD%A6%E6%B3%95/"
           data-tag="learn"
           data-author="" >
            <span class="post-title" title="费曼教学法">费曼教学法</span>
            <span class="post-date" title="2020-04-30 08:14:47">2020/04/30</span>
        </a>
        
        <a  class=""
           href="/blog/2020/03/29/test3/"
           data-tag="test3"
           data-author="" >
            <span class="post-title" title="beamer">beamer</span>
            <span class="post-date" title="2020-03-29 16:13:35">2020/03/29</span>
        </a>
        
        <a  class=""
           href="/blog/2020/03/29/vim/"
           data-tag="vim"
           data-author="" >
            <span class="post-title" title="test">test</span>
            <span class="post-date" title="2020-03-29 16:08:16">2020/03/29</span>
        </a>
        
        <a  class=""
           href="/blog/2020/05/30/emacs/"
           data-tag="emacs"
           data-author="" >
            <span class="post-title" title="emacs">emacs</span>
            <span class="post-date" title="2020-05-30 16:20:39">2020/05/30</span>
        </a>
        
        <a  class=""
           href="/blog/2020/04/17/driving/"
           data-tag="git"
           data-author="" >
            <span class="post-title" title="git">git</span>
            <span class="post-date" title="2020-04-17 14:18:03">2020/04/17</span>
        </a>
        
        <a  class=""
           href="/blog/2020/05/30/xgboost/"
           data-tag="machine learning"
           data-author="" >
            <span class="post-title" title="xgboost">xgboost</span>
            <span class="post-date" title="2020-05-30 16:30:11">2020/05/30</span>
        </a>
        
    </nav>
</div>
    </div>
    <div class="hide-list">
        <div class="semicircle">
            <div class="brackets first"><</div>
            <div class="brackets">&gt;</div>
        </div>
    </div>
</aside>
<div class="post">
    <div class="pjax">
        <article id="post-vim" class="article article-type-post" itemscope itemprop="blogPost">
    
        <h1 class="article-title">test</h1>
    
    <div class="article-meta">
        
        
        
        
        <span class="tag">
            
            <a class="color4">vim</a>
            
        </span>
        
    </div>
    <div class="article-meta">
        
        创建时间:<time class="date" title='更新时间: 2020-05-30 08:24:40'>2020-03-29 16:08</time>
        
    </div>
    <div class="article-meta">
        
        
        <span id="busuanzi_container_page_pv">
            阅读:<span id="busuanzi_value_page_pv">
                <span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </span>
        </span>
        
        
    </div>
    
    <div class="toc-ref">
    
        <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#vim常用命令记录"><span class="toc-text">vim常用命令记录</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Normal-mode"><span class="toc-text">Normal-mode</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#漫游"><span class="toc-text">漫游</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#复制"><span class="toc-text">复制</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#搜索"><span class="toc-text">搜索</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#剪切"><span class="toc-text">剪切</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#撤销"><span class="toc-text">撤销</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#快速编辑"><span class="toc-text">快速编辑</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim-快速编辑"><span class="toc-text">vim 快速编辑</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim相关视频"><span class="toc-text">vim相关视频</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim页面移动"><span class="toc-text">vim页面移动</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim-快速增删改查"><span class="toc-text">vim 快速增删改查</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim-搜索替换"><span class="toc-text">vim 搜索替换</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim-多文件操作"><span class="toc-text">vim 多文件操作</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim-textobject-操作"><span class="toc-text">vim textobject 操作</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim-复制粘贴与寄存器的使用"><span class="toc-text">vim 复制粘贴与寄存器的使用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#vim-的宏操作"><span class="toc-text">vim 的宏操作</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#gVim-的安装过程"><span class="toc-text">gVim 的安装过程</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#软件下载"><span class="toc-text">软件下载</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#spacevim-的使用方式"><span class="toc-text">spacevim 的使用方式</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#VimFiler"><span class="toc-text">VimFiler</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#键捆绑"><span class="toc-text">键捆绑</span></a></li></ol></li></ol></li></ol>
    
<style>
    .left-col .switch-btn,
    .left-col .switch-area {
        display: none;
    }
    .toc-level-3 i,
    .toc-level-3 ol {
        display: none !important;
    }
</style>
</div>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="vim常用命令记录"><a href="#vim常用命令记录" class="headerlink" title="vim常用命令记录"></a>vim常用命令记录</h2><p>VIM编辑器的用法，包含基础用法和高级用法。<br>VIM的配置文件是用户家目录下.vimrc, 修改该文件加入inoremap jj <Esc>, 表示映射ESC键到两次j键，可以提高操作效率</Esc></p>
<h2 id="Normal-mode"><a href="#Normal-mode" class="headerlink" title="Normal-mode"></a>Normal-mode</h2><p>用于浏览文件，也包含复制，粘贴，删除等操作。这种模式下，键盘按键会当做功能键处理，不会真正的键入这些字符</p>
<h3 id="漫游"><a href="#漫游" class="headerlink" title="漫游"></a>漫游</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">h 向左</span><br><span class="line">j 向下</span><br><span class="line">k 向上</span><br><span class="line">l 向右</span><br><span class="line">0 跳到行首</span><br><span class="line">^ 跳到行首第一个非空字符 一般采用0w取代</span><br><span class="line">$ 跳到行尾</span><br><span class="line">gg 跳到文件的第一行的行首</span><br><span class="line">G 快速到文件的最后一行的行尾</span><br><span class="line">% 匹配括号移动，包括(,&#123;,[  ]</span><br><span class="line">*|# 匹配光标当前所在的单词，移动光标到下一个单词处，*是下一个，#是上一个  hello world</span><br><span class="line">ctrl+f 查看下一页内容</span><br><span class="line">ctrl+b 查看上一页内容</span><br><span class="line">100G 跳转到第一百行的行首</span><br><span class="line">w&#x2F;W 移动到word&#x2F;WORD的开头,e&#x2F;E移动到下一个word&#x2F;WORD的末尾</span><br><span class="line">b&#x2F;B 回到上一个word&#x2F;WORD的开头</span><br></pre></td></tr></table></figure>

<h3 id="复制"><a href="#复制" class="headerlink" title="复制"></a>复制</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">yy 复制光标所在整行</span><br><span class="line">100yy 复制光标坐在行及以下共100行</span><br><span class="line">yw 复制光标开始的第一个单词</span><br><span class="line">y$ 复制光标到行尾</span><br><span class="line">yG 复制光标所在行到文本的结束</span><br><span class="line">yH 复制文本开始到光标所在行的文本</span><br></pre></td></tr></table></figure>
<h3 id="搜索"><a href="#搜索" class="headerlink" title="搜索"></a>搜索</h3><p>f{char}下一个{char}字符的位置,t移动到{char}字符前一个字符,;是走向下一个<br>(不过我试过了好像;并不好用)<br>F{char}是反向搜索</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">fa 移动光标到本行下一个a的字符处</span><br><span class="line">Fa 反前移动光标到字符a处</span><br><span class="line">nfa 移动光标到下第n个字符a处</span><br><span class="line">nFa 向前移动光标到第n个字符a处</span><br><span class="line">ta 移动光标到a字符的前一个字符</span><br><span class="line">nta 移动光标到第n个a字符前一个字符</span><br><span class="line">Ta 向前移动光标到a字符出现的后一个字符</span><br><span class="line">nTa 向前移动到第n个a字符出现后的一个字符</span><br><span class="line">yfB 复制光标到第一个大写B中间的内容</span><br><span class="line">y2fB 复制光标到第二个大写B中间的内容o 是新开一行</span><br><span class="line">$ 跳到行尾部</span><br><span class="line">gg 跳到文件第一行行首</span><br></pre></td></tr></table></figure>

<h3 id="剪切"><a href="#剪切" class="headerlink" title="剪切"></a>剪切</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">x 向后剪切一个字符，如果是行尾则向前剪切</span><br><span class="line">3x 剪切三个</span><br><span class="line">xp 非行尾交换两个字符，如果是bs编程sb</span><br><span class="line">visual模式选择后d剪切</span><br></pre></td></tr></table></figure>

<h3 id="撤销"><a href="#撤销" class="headerlink" title="撤销"></a>撤销</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">ctrl + h 撤销键入的一个字符</span><br><span class="line">ctrl + w 撤销键入的一个单词</span><br><span class="line">ctrl + u 撤销键入的一整行</span><br></pre></td></tr></table></figure>
<h3 id="快速编辑"><a href="#快速编辑" class="headerlink" title="快速编辑"></a>快速编辑</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">gi 跳转到最近插入模式编辑的位置并进入插入模式</span><br></pre></td></tr></table></figure>
<h3 id="vim-快速编辑"><a href="#vim-快速编辑" class="headerlink" title="vim 快速编辑"></a>vim 快速编辑</h3><ol>
<li>textobject</li>
<li><h3 id="vim相关视频"><a href="#vim相关视频" class="headerlink" title="vim相关视频"></a>vim相关视频</h3></li>
<li>(vim快速移动大法)[<a href="https://www.imooc.com/video/19449]" target="_blank" rel="noopener">https://www.imooc.com/video/19449]</a></li>
<li>知乎相关网站<h3 id="vim页面移动"><a href="#vim页面移动" class="headerlink" title="vim页面移动"></a>vim页面移动</h3>翻页命令太多，按照2/8原则，只需要记住最主要的就可以了</li>
<li>gg/G移动到文件首行和文件末行，按ctrl + o快速返回</li>
<li>H/M/L快速跳转到屏幕的开头(head),中间middle和结尾lower</li>
<li>Ctrl+u (upward)向上翻页 (evil) 模式无法使用 (没有设定),Ctrl + f (forward)向后翻页<br>zz 是将屏幕快速的放置到中间。 </li>
</ol>
<h3 id="vim-快速增删改查"><a href="#vim-快速增删改查" class="headerlink" title="vim 快速增删改查"></a>vim 快速增删改查</h3><ol>
<li>进入插入模式增加字符 </li>
<li>使用 a/i/o 增加字符。 </li>
<li>大写的 A/I/O 是什么作用？ </li>
<li>快速删除一个字符或者单词？<ul>
<li>normal 模式可以使用 x 删除一个字符。 </li>
<li>使用d(delete) 配合文本对象快速删除一个单词daw(d around the word)</li>
<li>d 和 x 可以搭配数字来执行多次。</li>
</ul>
</li>
</ol>
<h3 id="vim-搜索替换"><a href="#vim-搜索替换" class="headerlink" title="vim 搜索替换"></a>vim 搜索替换</h3><ol>
<li>substitude命令允许我们查找并替换文本<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">:[range]s[ubstitude]&#x2F;&#123;pattern&#125;&#x2F;&#123;string&#125;&#x2F;[flags]</span><br></pre></td></tr></table></figure>
<ul>
<li>range表示范围，比如<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">:10,20</span><br></pre></td></tr></table></figure>
表示10-20行，%表示全局匹配</li>
<li>pattern表示要替换的模式,string表示替换后的文本</li>
<li>flags表示替换的标志：<ul>
<li>g(gloabl)表示全局范围内执行<ul>
<li>c(confirm)表示确认，可以确认或者拒绝修改</li>
</ul>
</li>
<li>n(number)报告匹配的次数而不替换，可以用来查询匹配次数</li>
<li>{pattern} 可以使用 /<string> 精确匹配</string></li>
</ul>
</li>
</ul>
</li>
</ol>
<h3 id="vim-多文件操作"><a href="#vim-多文件操作" class="headerlink" title="vim 多文件操作"></a>vim 多文件操作</h3><ol>
<li>理解buffer window tab 之间的区别;</li>
<li>buffer 切换<ul>
<li>使用:ls 查看有多少个buffer</li>
<li>使用:b n 跳转到第n个buffer</li>
<li>:bnext(nvim好像是:bn),:bpre(:bp),:bfirst,:blast</li>
<li>:b buffer_name 以名字加上tab补全来进行切换进行跳转</li>
</ul>
</li>
<li>窗口<ul>
<li>窗口表示一个分割的区域</li>
<li>一个缓冲器可以分割成多个窗口，每个窗口也可以分割成多个缓冲区域</li>
<li>&lt;Ctrl+w&gt; s 可以水平分割窗口，&lt;Ctrl+w&gt; v 垂直分割窗口，或者可以使用:sp 和:vs 代替 </li>
<li>&lt;Ctrl+w&gt; w 循环切换窗口</li>
<li>&lt;Ctrl+w&gt; h 切换到左边窗口</li>
<li>&lt;Ctrl+w&gt; j 切换到下边窗口</li>
<li>&lt;Ctrl+w&gt; k 切换到上边窗口</li>
<li>&lt;Ctrl+w&gt; l 切换到右边窗口</li>
<li>&lt;Ctrl+w&gt; = 使所有窗口等高等宽</li>
<li>&lt;Ctrl+w&gt; _ 最大化活动窗口的高度</li>
<li>&lt;Ctrl+w&gt; | 最大化活动窗口的宽度。</li>
</ul>
</li>
<li>Tab 是容纳一些窗口的容器。(:h tabpage)<ul>
<li>vim 的tab 和其他编辑器的tab不太一样。可以想象成linux的虚拟桌面。</li>
<li>tab 使用不多，简单了解就好</li>
<li>:tabe[dit] {filename} 在新标签页打开filename</li>
<li>&lt;Ctrl+w&gt; T 将当前窗口移动到一个新标签页。</li>
<li>:tabc[lose] 关闭当前标签页中的所有窗口。</li>
<li>:tabo[nly] 只保留活动标签页，关闭其他标签页。</li>
<li>{N}gt 切换到编号为N的标签页。</li>
<li>gt 切换到下一个标签页。</li>
<li>gT 切换到上一个标签页。<h3 id="vim-textobject-操作"><a href="#vim-textobject-操作" class="headerlink" title="vim textobject 操作"></a>vim textobject 操作</h3></li>
</ul>
</li>
<li>Text Object 表示文本对象,比如一个单词，一个句子，一个段落。</li>
<li>[number]<command>[textobject]</li>
<li>textobject 表示要操作的文本对象，w表示单词，s句子,p段落。</li>
<li>示例: 使用diw 和 daw 删除word<br>-this is a [ word ] <ul>
<li>this is a [word]</li>
</ul>
</li>
</ol>
<h3 id="vim-复制粘贴与寄存器的使用"><a href="#vim-复制粘贴与寄存器的使用" class="headerlink" title="vim 复制粘贴与寄存器的使用"></a>vim 复制粘贴与寄存器的使用</h3><ol>
<li>vim normal模式下的复制粘贴。<ul>
<li>normal 模式下分别使用y(yank)和p(put)，剪贴d和p</li>
<li>可使用v 进入可视模式，然后选择需要复制的地方，再使用p粘贴。</li>
<li>配合文本对象的使用，yy复制一行，yiw复制一个单词。</li>
<li>配合文本对象的使用，yy复制一行，yiw复制一个单词。</li>
</ul>
</li>
<li>vim insert模式下的复制粘贴。很多人会使用鼠标选中，然后ctrt+v或cmd+v粘贴<ul>
<li>粘贴代码的坑：vimrc里设置的autoident导致粘贴后代码缩进混乱。</li>
<li>这个时候需要使用:set paste 和 :set nopaste解决。 </li>
</ul>
</li>
<li>vim寄存器<ul>
<li>vim不使用单一剪贴板进行剪贴，而是有多组寄存器 </li>
<li>通过”{register} 前缀可指定寄存器，不指定默认用无名寄存器。</li>
<li>例如 “ayiw将一个单词复制到寄存器中，”byy将一行复制到寄存器b中。</li>
<li>“ap将寄存器a中的内容粘贴出来，”bp 将寄存器b中的内容粘贴出来。</li>
<li>vim 中””表示默认寄存器，因此””p将相当于p。</li>
<li>除了a-z,其他常见寄存器: <ul>
<li>复制专用寄存器 “0 使用y复制文本同时会被拷贝到复制寄存器0 </li>
<li>系统剪贴板 “+</li>
<li>“% 当前文件名 “. 上次插入的文本 </li>
<li>:set clipboard=unnamed 可以让你直接复制粘贴剪贴板的内容。 <h3 id="vim-的宏操作"><a href="#vim-的宏操作" class="headerlink" title="vim 的宏操作"></a>vim 的宏操作</h3></li>
</ul>
</li>
</ul>
</li>
<li>什么是 vim 的 宏<ul>
<li>可以看成是命令的集合</li>
<li>可以使用宏录制一系列的操作，然后再回放。</li>
<li>宏可以非常方便的将命令集合作用在多行文本上。</li>
<li>normal mode 下使用 q录制宏，同时也是q来结束录制宏。</li>
<li>使用q{register}来选择要保存的寄存器,把录制的命令保存在其中。</li>
<li>使用@{register}来回放寄存器中保存的一系列命令。</li>
<li>test<br><a href="http://www.baidu.com" target="_blank" rel="noopener">http://www.baidu.com</a><br><a href="http://www.youtube.com" target="_blank" rel="noopener">http://www.youtube.com</a><br><a href="http://linux.edu" target="_blank" rel="noopener">http://linux.edu</a> <h3 id="gVim-的安装过程"><a href="#gVim-的安装过程" class="headerlink" title="gVim 的安装过程"></a>gVim 的安装过程</h3><h4 id="软件下载"><a href="#软件下载" class="headerlink" title="软件下载"></a>软件下载</h4></li>
</ul>
</li>
<li>从<a href="https://github.com/vim/vim-win32-installer/releases" target="_blank" rel="noopener">https://github.com/vim/vim-win32-installer/releases</a> 下载gvim,分别有32位版本和64位版本，我下载的是64位版本</li>
<li>一路安装完成后，在$HOME路径下创建一个_vimrc文件，作为gvim的私人配置文件?</li>
</ol>
<h3 id="spacevim-的使用方式"><a href="#spacevim-的使用方式" class="headerlink" title="spacevim 的使用方式"></a>spacevim 的使用方式</h3><h4 id="VimFiler"><a href="#VimFiler" class="headerlink" title="VimFiler"></a>VimFiler</h4><ol>
<li>使用:VimFiler [路径名] 打开VimFiler, 比如使用<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">:VimFiler c:\</span><br></pre></td></tr></table></figure>
打开c盘下的VimFiler</li>
<li>h跳到父路径，l跳到子路径,j 和k 移动</li>
</ol>
<h4 id="键捆绑"><a href="#键捆绑" class="headerlink" title="键捆绑"></a>键捆绑</h4><ul>
<li>SPC ;  //注释</li>
<li>太多了，参见<a href="https://spacevim.org/documentation/" target="_blank" rel="noopener">spacevim</a></li>
</ul>

      
       <hr><span style="font-style: italic;color: gray;"> 转载请注明来源，欢迎对文章中的引用来源进行考证，欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论，也可以邮件至 jaytp@qq.com </span>
    </div>
</article>


<p>
    <a  class="dashang" onclick="dashangToggle()">赏</a>
</p>


<div class="article_copyright">
    <p><span class="copy-title">文章标题:</span>test</p>
    
    <p><span class="copy-title">本文作者:</span><a  title="Jacklisp">Jacklisp</a></p>
    <p><span class="copy-title">发布时间:</span>2020-03-29, 16:08:16</p>
    <p><span class="copy-title">最后更新:</span>2020-05-30, 08:24:40</p>
    <span class="copy-title">原始链接:</span><a class="post-url" href="/blog/2020/03/29/vim/" title="test">http://yoursite.com/2020/03/29/vim/</a>
    <p>
        <span class="copy-title">版权声明:</span><i class="fa fa-creative-commons"></i> <a rel="license noopener" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" title="CC BY-NC-SA 4.0 International" target = "_blank">"署名-非商用-相同方式共享 4.0"</a> 转载请保留原文链接及作者。
    </p>
</div>





    




    </div>
    <div class="copyright">
        <p class="footer-entry">©2016-2019 Yelog</p>
<p class="footer-entry">Built with <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/yelog/hexo-theme-3-hexo" target="_blank">3-hexo</a> theme</p>

    </div>
    <div class="full-toc">
        <button class="full"><span class="min "></span></button>
<button class="post-toc-menu"><span class="post-toc-menu-icons"></span></button>
<div class="post-toc"><span class="post-toc-title">目录</span>
    <div class="post-toc-content">

    </div>
</div>
<a class="" id="rocket" ></a>

    </div>
</div>
<div class="acParent"></div>

<div class="hide_box" onclick="dashangToggle()"></div>
<div class="shang_box">
    <a class="shang_close"  onclick="dashangToggle()">×</a>
    <div class="shang_tit">
        <p>喜欢就点赞,疼爱就打赏</p>
    </div>
    <div class="shang_payimg">
        <div class="pay_img">
            <img src="/blog/img/alipay.jpg" class="alipay" title="扫码支持">
            <img src="/blog/img/weixin.jpg" class="weixin" title="扫码支持">
        </div>
    </div>
    <div class="shang_payselect">
        <span><label><input type="radio" name="pay" checked value="alipay">支付宝</label></span><span><label><input type="radio" name="pay" value="weixin">微信</label></span>
    </div>
</div>


</body>
<script src="/blog/js/jquery.pjax.js?v=1.0.1" ></script>

<script src="/blog/js/script.js?v=1.0.1" ></script>
<script>
    var img_resize = 'default';
    /*作者、标签的自动补全*/
    $(function () {
        $('.search').AutoComplete({
            'data': ['#emacs','#科研','#git','#android','#linux','#learn','#vim','#test3','#machine learning',],
            'itemHeight': 20,
            'width': 418
        }).AutoComplete('show');
    })
    function initArticle() {
        /*渲染对应的表格样式*/
        
            $(".post .pjax table").addClass("green_title");
        

        /*渲染打赏样式*/
        
        $("input[name=pay]").on("click", function () {
            if($("input[name=pay]:checked").val()=="weixin"){
                $(".shang_box .shang_payimg .pay_img").addClass("weixin_img");
            } else {
                $(".shang_box .shang_payimg .pay_img").removeClass("weixin_img");
            }
        })
        

        /*高亮代码块行号*/
        
        $('pre code').each(function(){
            var lines = $(this).text().trim().split('\n').length, widther='';
            if (lines>99) {
                widther = 'widther'
            }
            var $numbering = $('<ul/>').addClass('pre-numbering ' + widther).attr("unselectable","on");
            $(this).addClass('has-numbering ' + widther)
                    .parent()
                    .append($numbering);
            for(var i=1;i<=lines;i++){
                $numbering.append($('<li/>').text(i));
            }
        });
        

        /*访问数量*/
        
        $.getScript("//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js");
        

        /*代码高亮，行号对齐*/
        $('.pre-numbering').css('line-height',$('.has-numbering').css('line-height'));

        
        
    }

    /*打赏页面隐藏与展示*/
    
    function dashangToggle() {
        $(".shang_box").fadeToggle();
        $(".hide_box").fadeToggle();
    }
    

</script>

<!--加入行号的高亮代码块样式-->

<style>
    pre{
        position: relative;
        margin-bottom: 24px;
        border-radius: 10px;
        border: 1px solid #e2dede;
        background: #FFF;
        overflow: hidden;
    }
    code.has-numbering{
        margin-left: 30px;
    }
    code.has-numbering.widther{
        margin-left: 35px;
    }
    .pre-numbering{
        margin: 0px;
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        padding: 0.5em 3px 0.7em 5px;
        border-right: 1px solid #C3CCD0;
        text-align: right;
        color: #AAA;
        background-color: #fafafa;
    }
    .pre-numbering.widther {
        width: 35px;
    }
</style>

<!--自定义样式设置-->
<style>
    
    
    .nav {
        width: 542px;
    }
    .nav.fullscreen {
        margin-left: -542px;
    }
    .nav-left {
        width: 120px;
    }
    
    
    @media screen and (max-width: 1468px) {
        .nav {
            width: 492px;
        }
        .nav.fullscreen {
            margin-left: -492px;
        }
        .nav-left {
            width: 100px;
        }
    }
    
    
    @media screen and (max-width: 1024px) {
        .nav {
            width: 492px;
            margin-left: -492px
        }
        .nav.fullscreen {
            margin-left: 0;
        }
        .nav .hide-list.fullscreen {
            left: 492px
        }
    }
    
    @media screen and (max-width: 426px) {
        .nav {
            width: 100%;
        }
        .nav-left {
            width: 100%;
        }
    }
    
    
    .nav-right .title-list nav a .post-title, .nav-right .title-list #local-search-result a .post-title {
        color: #383636;
    }
    
    
    .nav-right .title-list nav a .post-date, .nav-right .title-list #local-search-result a .post-date {
        color: #5e5e5f;
    }
    
    
    .nav-right nav a.hover, #local-search-result a.hover{
        background-color: #e2e0e0;
    }
    
    

    /*列表样式*/
    
    .post .pjax article .article-entry>ol, .post .pjax article .article-entry>ul, .post .pjax article>ol, .post .pjax article>ul{
        border: #e2dede solid 1px;
        border-radius: 10px;
        padding: 10px 32px 10px 56px;
    }
    .post .pjax article .article-entry li>ol, .post .pjax article .article-entry li>ul,.post .pjax article li>ol, .post .pjax article li>ul{
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .post .pjax article .article-entry>ol>li, .post .pjax article .article-entry>ul>li,.post .pjax article>ol>li, .post .pjax article>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    .post .pjax article .article-entry li>ol>li, .post .pjax article .article-entry li>ul>li,.post .pjax article li>ol>li, .post .pjax article li>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    

    /* 背景图样式 */
    
    


    /*引用块样式*/
    

    /*文章列表背景图*/
    
    .nav-right:before {
        content: ' ';
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        opacity: 0.3;
        background: url("/bloghttps://i.loli.net/2019/07/22/5d3521411f3f169375.png");
        background-repeat: no-repeat;
        background-position: 50% 0;
        -ms-background-size: cover;
        -o-background-size: cover;
        -moz-background-size: cover;
        -webkit-background-size: cover;
        background-size: cover;
    }
    

    
</style>







</html>
